
# 按间距中的绿色按钮以运行脚本。
import textwrap
import os
if __name__ == '__main__':
    # 删除首行
    with open('test1.c', 'r') as file1:
        lines = file1.readlines()
    lines = lines[1:]
    with open('processed_data.txt', 'w') as file2:
        for line in lines:
            file2.write(line)

    # 打开导出的文件
    file = open('processed_data.txt', 'r')
    # 读取文件内容
    content = file.read()

    # 关闭文件
    file.close()

    # 删除文字
    content = content.replace('0X', '')
    content = content.replace('\n', '')
    content = content.replace(',', '')
    content = content.replace('}', '')
    content = content.replace(';', '')
    content = textwrap.wrap(content, width=60)
    print(content)
    new_content = '\n'.join(content)
    # 打开文件
    file = open('pic_ram.v', 'w')

    # 将修改后的内容写入文件
    file.write(new_content)

    # 关闭文件
    file.close()

    # 删除过程文件
    os.remove('processed_data.txt')



